package com.example.front.dao;

import com.example.gok_mall.entity.Shipping;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface ShippingDao {
    int deleteByPrimaryKey(Integer id);

    int insert(Shipping record);

    int insertSelective(Shipping record);

    Shipping selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Shipping record);

    int updateByPrimaryKey(Shipping record);

    //同时根据用户Id和地址Id来删除地址，防止横向越权
    int deleteByShippingIdByUserId(@Param("userId") Integer userId, @Param("shippongId") Integer shippongId);

    //修改地址接口
    int updateByshipping(Shipping record);

    //查询收货地址接口
    Shipping selectByShippingIdByUserId(@Param("userId") Integer userId, @Param("shippongId") Integer shippongId);

    //查询所有收获地址接口
    List<Shipping> selectByUserId(Integer userId);
}